import Content from '@/sheep/layouts/content.vue';
import { request } from '@/sheep/request';
import { SELECT, RECYCLE_BIN, CRUD, RECYCLE } from '@/sheep/request/crud';

const route = {
  path: 'supplybackend',
  name: 'supplychian.admin.supplybackend',
  component: Content,
  meta: {
    title: '供应链后台',
  },
  children: [
    {
      path: 'merchant',
      name: 'supplychian.admin.supplybackend.merchant',
      component: () => import('./merchant/index.vue'),
      meta: {
        title: '供应链商家',
      },
    },
    {
      path: 'shop',
      name: 'supplychian.admin.supplybackend.shop',
      component: () => import('./shop/index.vue'),
      meta: {
        title: '鲸喜云店列表',
      },
    },
    {
      path: 'goods',
      name: 'supplychian.admin.supplybackend.goods',
      component: () => import('./goods/index.vue'),
      meta: {
        title: '商品列表',
      },
    },
  ],
};

const api = {
  // 获取供应商列表
  supplyList: (params) =>
    request({
      url: '/shop/yb/goods/channelgoods/channelList',
      method: 'GET',
      params,
    }),
  // 获取选品库
  getStoreList: (data) =>
    request({
      url: '/shop/yb/goods/channelgoods/getChannelHouseList',
      method: 'POST',
      data,
    }),
  // 新增选品库
  addStore: (data) =>
    request({
      url: '/shop/yb/goods/channelgoods/addChannelHouse',
      method: 'POST',
      data,
    }),
  // 修改选品库
  editStore: (data) =>
    request({
      url: '/shop/yb/goods/channelgoods/editChannelHouse',
      method: 'POST',
      data,
    }),
  // 获取渠道商品列表
  goodList: (data) =>
    request({
      url: '/shop/yb/goods/channelgoods/list',
      method: 'POST',
      data,
    }),
  // 选中商品入库
  addGoods: (data) =>
    request({
      url: '/shop/yb/goods/channelgoods/addYzhGoods',
      method: 'POST',
      data,
    }),
  // 获取商品库中的商品
  getGoodsList: (data) =>
    request({
      url: '/shop/yb/goods/channelgoods/getHouseGoods',
      method: 'POST',
      data,
    }),
  // 获取商品库中商品详情
  getGoodsDetail: (id) =>
    request({
      url: `/shop/yb/goods/channelgoods/getHouseGoodsDetails/${id}`,
      method: 'GET',
    }),
  // 获取商品分类接口
  getGoodsClass: (data) =>
    request({
      url: '/shop/yb/goods/channelgoods/getGoodsCategory',
      method: 'POST',
      data,
    }),
    // 保存库中商品
    saveGoods: (data) =>
    request({
      url: '/shop/yb/goods/channelgoods/saveHouseGoods',
      method: 'POST',
      data,
    }),
    // 获取店铺列表
    getShopList: (data) =>
    request({
      url: '/shop/yb/goods/channelgoods/getStoreList',
      method: 'GET',
      params:data,
    }),

  // 获取服务商列表
  serviceList: (params) =>
    request({
      url: '/main/admin/application/application/agentList',
      method: 'GET',
      params,
    }),
  checkInAssagn: (data) =>
    request({
      url: '/main/admin/application/application/assign',
      method: 'POST',
      data,
    }),
  type: () =>
    request({
      url: '/main/admin/application/application/typeList',
      method: 'GET',
    }),
    service: {
        ...CRUD('shop/admin/goods/service'),
        select: (params) => SELECT('shop/admin/goods/service', params),
      },
};

export { route, api };
